/*
 * Output.h
 *
 *  Created on: Jun 7, 2011
 *      Author: timothy
 */

#ifndef OUTPUT_H
#define OUTPUT_H

#include "unionfind.h"
#include "loadgraph.h"

class Vertex;

typedef struct edge_t{
	int from;
	int to;
	edge_t *next;
} edge;


class OutFile
{
	private:
		InFile *In;
		UnionFindTree *Union;
		FILE *stream;
		int edgeCounter;
		edge *edgeList;
		edge *mostRecentEdge;
		char *inBuff;
		list<int> vertexList;

		int doneWithFile;

		void writeHeader();
		void writeNextEntry();
		int readVertex();
		void addEdge(int from, int to);
	public:
		// FIELDS //

		// CONSTRUCTORS //
		OutFile(InFile *in, UnionFindTree *uni);
		~OutFile();

		// METHODS //
		void Write();
};

#endif
